<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="<%=basePath %>js/jquery-1.9.0.js"></script>
<script type="text/javascript" src="<%=basePath %>js/jquery.qrcode.min.js"></script>
<title>userinfo</title>

<script type="text/javascript">

$(function(){
	
	//生成二维码
		var quickMark= $.trim($("#quickMark").val());
	if(quickMark!=""){
		$('#qrcode').qrcode(quickMark);
	}
	//给textarea 赋值
	var remark_ = "${user.remark}";
	$("#remark").text(remark_);
	
	
	//TODO 手机号码校验 待修改
	$("#mobile").blur(function(){
		var mobile= $("#mobile").val();
		//校验手机号码格式是否正确
		if(mobile.length!=11){
			alert("手机号码长度不正确");
		}
	});
	
	//文本框失去焦点时执行校验邮箱格式
	$("#email").blur(function(){
		var email= $("#email").val();
		//校验邮箱格式是否正确
		if(!email.match(/^[a-z0-9]+([._]*[a-z0-9]+)*@[a-z0-9]+([_.][a-z0-9]+)+$/gi)){
			alert("邮箱格式不正确")
		}
	});
	
});

//跳转到用户信息编辑界面
function toUserCenterEdit(){
	location.href="<%=basePath%>user/tousercenteredit";
}
//跳转到修改密码界面
function toModifyPassword(){
	location.href="<%=basePath%>user/tomodifypassword";
}

//跳转到修改密码界面
function toModifyPayPassword(){
	location.href="<%=basePath%>user/toModifyPayPassword";
}


//跳转到银行卡界面
function toDebitCard(){
	location.href="<%=basePath%>user/toDebitCard";
}

//跳转到我的队伍页面
function toUserTeamIndex(){
	location.href="<%=basePath%>team/toMyTeam";
}

//跳转到修改密码界面
function toModifyPayPassword(){
	location.href="<%=basePath%>user/toModifyPayPassword";
}


//跳转到银行卡界面
function toDebitCard(){
	location.href="<%=basePath%>user/toDebitCard";
}

//跳转到我的队伍页面
function toUserTeamIndex(){
	location.href="<%=basePath%>team/toMyTeam";
}

//退出
function logout(){
	
	$.ajax({
		type : "POST",
		url : "<%=basePath%>user/logout",
		success : function(result) {
				alert("退出成功!")
		},
		error : function(error) {
			alert("error")
		}

	});
}


</script>

</head>
<body>

		<!-- 编辑信息 -->
		<button id="editinfobtn" name="editinfobtn" onclick="toUserCenterEdit()">编辑个人信息</button>
		<button id="logoutbtn" name="logoutbtn" onclick="logout()">退出</button>
		<!-- 修改密码 -->
		<button id="modifypasswordbtn" name="modifypasswordbtn" onclick="toModifyPassword()">修改密码</button>
		
		<!-- 设置支付密码 -->
		<button id="modifyPayPasswordBtn" name="modifyPayPasswordBtn" onclick="toModifyPayPassword()">修改支付密码</button>
		
		<!-- 我的队伍 -->
		<button id="myTeamBtn" name="myTeamBtn" onclick="toUserTeamIndex()">我的队伍</button>
		

		<!-- 管理银行卡 -->
		<button id="toDebitCardBtn" name="toDebitCardBtn" onclick="toDebitCard()">管理银行卡</button>
		
		手机:<input type="text" id="mobile" name="mobile" value="${user.mobile}"  maxlength="11" onkeyup='this.value=this.value.replace(/\D/gi,"")' />
	
		<br/>
		邮箱:<input type="text" id="email" name="email" value="${user.email}" maxlength="32" />
		<br/>
		
		
		

		用户名:<input type="text" id="username" name="username" value="${user.username}" maxlength="16" />
		<br/>
		姓名:<input type="text" id="name" name="name" value="${user.name}" maxlength="32"/>
		<br/>
		身份证:<input type="text" id="identityCard" name="identityCard" value="${user.identityCard}" maxlength="18" /> 
		<br/>
		电话:<input type="text" id="telphone" name="telphone" value="${user.telephone}" maxlength="16" />
		<br/>
		
		地址:<input type="text" id="adress" name="adress" value="${user.address}" maxlength="200"/>
		<br/>
		佣金:<input type="text" id="commission" value="${user.commission}" name="commission" />
		<br/>
		
		推广链接:<input type="text" id="quickMark" value="${user.quickMark}" name="quickMark"/>
		<br/>
		
		<div id="qrcode"></div>
		
		<br/>
		<!-- 头像 -->
		账户状态:<input type="text" id="status" name="status" value="${user.status}"  />
		<br/>
		
		备注:<textarea id="remark" name="remark" rows="10" cols="20" maxlength="200"></textarea>
</body>
</html>